﻿using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Mvc.Ajax;

namespace Citi.Helpers.Extensions
{
    public static class ValidationSummaryExtension
    {
        /// <summary>
        /// Creates a validation summary with a container element
        /// surrounding the summary and error messages.
        /// </summary>        
        public static MvcHtmlString ValidationSummaryWithContainer(this HtmlHelper ext, string message)
        {
            var summaryoutput = ext.ValidationSummary(message);
            if (summaryoutput == null)
                return new MvcHtmlString("");

            var sb = new MvcHtmlString("<div class='validation-summary-errors-container'>" + summaryoutput + "</div>");
            return sb;
        }
    }
}